/*
 * > /*
>  * INSANE - Interactive Structural Analysis Environment
>  *
>  * Copyright (C) 2003-2004
>  * Universidade Federal de Minas Gerais
>  * Escola de Engenharia
>  * Departamento de Engenharia de Estruturas
>  *
>  * Author's email :     insane@dees.ufmg.br
>  * Author's Website :   http://www.dees.ufmg.br/insane
>  *
>  * This program is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU General Public License
>  * as published by the Free Software Foundation; either version 2
>  * of the License, or any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program; if not, write to the Free Software
>  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-
> 1307, USA.
 *
 */

package br.ufmg.dees.insane.draw;

import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.GeneralPath;
import java.util.Vector;

/**
 * @author Fonseca, Flavio & Pitangueira, Roque
 * @since	July 2004
 */
public class SequenceDraw extends Draw {
	
	private double factor;
	private double[] x;
	private double[] y;
	
//*****************************************************************************
	
    public SequenceDraw(int n, double[] x, double[] y) {
		this.x = new double[n];
		this.y = new double[n];
		for (int i=0; i<n; i++) {
			this.x[i] = x[i];
			this.y[i] = y[i];
		}
    }
	
    public SequenceDraw(int n, double[] x, double[] y, Object represents) {
		this(n,x,y);
		this.setRepresents(represents);
    }
    
//*****************************************************************************
	
    public SequenceDraw() {
    }
	
//*****************************************************************************
	
	public void setFactor(double a) {
		this.factor = a;
	}
	
//*****************************************************************************
	
	public double getFactor() {
		return factor;
	}
	
//*****************************************************************************
	
    public boolean equals(Object obj) {
        return false;
    }
	
//*****************************************************************************
	
    public Vector<Object> getShapes() {
        return null;
    }
	
//*****************************************************************************
	
    /**
     * Draws in a given Graphics.
     *
     * @see   java.awt.Graphics
     */
    public void draw(Graphics2D g2) {
        
		//int x1 = this.getLocation().x;
        //int y1 = this.getLocation().y;
		//double scale = this.getScale();
		float x1 = (float)this.x[0];
        float y1 = (float)this.y[0];
		double scale = 1.0;
		
		int n = this.x.length;
		
		GeneralPath gp = new GeneralPath();
		gp.moveTo(x1,y1);
		
		for (int i=0; i<n; i++) {
			
			float x = (float)(this.x[i] * scale);
			float y = (float)(this.y[i] * scale);
			gp.lineTo(x, y);
			
		}
		g2.draw(gp);
    } 
    
//*****************************************************************************
	
    /**
     * Returns the draw bounds in device units.
     *
     * @return the draw bounds
     */
    public Rectangle getBounds() {
        
        int x1 = this.getLocation().x;
        int y1 = this.getLocation().y;
        int x2 = this.getSize().width;
        int y2 = this.getSize().height;
        
        Rectangle rect = new Rectangle(x1, y1, x2 - x1, y2 - y1);
        
        return rect;
    }
    
//*****************************************************************************
}
